"""
打印菱形
"""
#输入要输出几乘几的菱形,以及组成菱形的字符
#如果是奇数则要求重新输入
while True:
    ret = int(input("请输入菱形大小（奇数）:>>"))
    if ret%2 == 0:
        print("请输入奇数~")
    else:
        break

char = str(input("请输入组成菱形的字符:>>"))
#5
#i
#0 _ _ # _ _
#1 _ # # # _
#2 # # # # #
#3 _ # # # _
#4 _ _ # _ _
print(f"菱形大小为{ret}*{ret}，组成字符为{char}")

for i in range(ret):
    for j in range(ret):
        #输出菱形前半部分
        if j<ret//2-i or j>ret//2+i and i<ret//2+1:
            print(" ",end='')
        elif ret//2-i <= j <= ret//2+i and i<ret//2+1:
            print(char,end='')
        # if j == ret//2+i+1 and i<ret//2+1:
        #     print()
    #输出后半部分
        if j<i-2 and i>=ret//2+1:
            print(" ",end='')
        elif i-2 <= j <= ret-i+1 and i>=ret//2+1:
            print(char, end='')
    print()








